package com.jakewharton.rxbinding4.component;

import com.google.auto.value.AutoValue;

import io.reactivex.rxjava3.annotations.NonNull;
import ohos.agp.components.Text;
import ohos.app.Context;

/**
 * A text-change event on a view.
 * <p>
 * <strong>Warning:</strong> Instances keep a strong reference to the view. Operators that cache
 * instances have the potential to leak the associated {@link Context}.
 */
@AutoValue
public abstract class TextTextUpdateEvent {
    /**
     * Create text text update event
     *
     * @param view   view
     * @param text   text
     * @param start  start
     * @param before before
     * @param count  count
     * @return the text text update event
     */
    @NonNull
    public static TextTextUpdateEvent create(
            @NonNull Text view, @NonNull String text, int start, int before, int count) {
        return new AutoValue_TextTextUpdateEvent(view, text, start, before, count);
    }

    /**
     * Text text update event
     */
    TextTextUpdateEvent() {}

    /**
     * The view from which this event occurred.
     *
     * @return the text
     */
    @NonNull
    public abstract Text view();

    /**
     * Text string
     *
     * @return the string
     */
    @NonNull
    public abstract String text();

    /**
     * Start int
     *
     * @return the int
     */
    public abstract int start();

    /**
     * Before int
     *
     * @return the int
     */
    public abstract int before();

    /**
     * Count int
     *
     * @return the int
     */
    public abstract int count();
}
